import request from '@/utils/request'


export function logout() {
  return request({
    url: 'logout',
    method: 'post'
  })
}

// id查询用户
export function getUser(id) {
  return request({
    url: '/sys/user/get/' + id,
    method: 'get'
  })
}
// orgId查询用户
export function getUserByOrgId(id) {
  return request({
    url: '/sys/user/getByOrgId/' + id,
    method: 'get'
  })
}
// 当前登录用户
export function currentUser() {
  return request({
    url: '/sys/user/current',
    method: 'get'
  })
}
// 用户列表
export function listUser(data) {
  return request({
    url: '/sys/user/list',
    method: 'post',
    data: data
  })
}
// 在线用户列表
export function onlineList(data) {
  return request({
    url: '/sys/user/onlineList',
    method: 'post',
    data: data
  })
}
// 注销在线用户
export function logoutUser(key) {
  return request({
    url: '/sys/user/logoutUser',
    method: 'delete',
    params: { key: key }
  })
}
// 获得用户上级
export function listParent(orgId) {
  return request({
    url: '/sys/org/listParent',
    method: 'get',
    params: { orgId: orgId }
  })
}
// 删除用户
export function deleteUser(data) {
  return request({
    url: '/sys/user/delete',
    method: 'delete',
    data: data
  })
}
// 重置用户密码
export function resetPassword(data) {
  return request({
    url: '/sys/user/resetPassword',
    method: 'post',
    data: data
  })
}
// 用户锁定
export function lockUser(ids) {
  return request({
    url: '/sys/user/lock',
    method: 'post',
    data: { ids: ids }
  })
}
// 用户解锁
export function unLockUser(ids) {
  return request({
    url: '/sys/user/unlock',
    method: 'post',
    data: { ids: ids }
  })
}
// 用户保存
export function getSaveUser(data) {
  return request({
    url: '/sys/user/save',
    method: 'get',
    params: data
  })
}
// 用户修改密码
export function changePassword(data) {
  return request({
    url: '/sys/user/changePassword',
    method: 'post',
    data: data
  })
}
// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/sys/user/uploadAvatar',
    method: 'post',
    data: data
  })
}
// 用户修改基本信息
export function changeUserInfo(data) {
  return request({
    url: '/sys/user/changeInfo',
    method: 'post',
    data: data
  })
}
